home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-10-12 | 1.6 KB | 40 lines | [TEXT/ToyS] |
- -- PageSentry Notification Applet
- -- SaveFile
-
- on «event SENTfail» sentryName given «class FURL»:failedURL, «class XTRA»:extra, «class STAT»:Status
-
- -- Create a variable containing all of the information we were sent plus appropriate labels
- set myMessage to ¬
- "=================================================================" & return & return & ¬
- "Received Sentry Event" & return & return & ¬
- "SentryName: " & sentryName & return & return & ¬
- "Failed URL: " & failedURL & return & ¬
- "Extra: " & extra & return & ¬
- "Status: " & Status & return & return
-
- -- Create a pathname to the file we want to store the results in based on the root level of the statup disk
- set theFileName to (path to startup disk as string) & "Sentry Results"
-
- -- Try to open the file, if we fail create it and then open it
- try
- set myFileRef to (open for access file theFileName with write permission)
- on error
- tell application "Finder" to make file at startup disk with properties ¬
- {name:"Sentry Results"}
-
- set myFileRef to (open for access file theFileName with write permission)
- end try
-
- -- Write out the information we have and close the file
- try
- set myErr to write myMessage to myFileRef starting at eof
- close access myFileRef
- on error errString number theErrorNumber
- close access myFileRef
- end try
-
- -- Tell the finder to open the file we just wrote to (This will most likely open in SimpleText)
- -- If you don't want the Finder to automatically open the file, comment out this line
- tell application "Finder" to open file "Sentry Results" of startup disk
-
- end «event SENTfail»